package com.yd.basemodule.base

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider

/**
 * <pre>
 *     author : yh
 *     e-mail : xxx@xx
 *     time   : 2023/12/22
 *     desc   :
 * </pre>
 */
class ViewModelFactory:ViewModelProvider.Factory {

    companion object{
        private var sInstance: ViewModelFactory?=null

        fun getInstance()= sInstance ?: ViewModelFactory().also { sInstance =it }
    }
    override fun <T : ViewModel?> create(modelClass: Class<T>): T {
        return modelClass.newInstance()
    }
}